<template>
	<view class="content">
		<view class="banner">
			<uv-image :src="banner" width="100%" height="auto" mode="widthFix"></uv-image>
		</view>
		<view class="title">会议日程</view>
		<view class="cardView">
			<view class="cardItme" v-for="(item,index) in list" :key="index" @click="openFun(item)">
				<view class="imgView" v-if="item.img">
					<image :src="item.img" class="img" mode="widthFix"></image>
				</view>
				<view class="text" v-if="item.text">
					<view>{{ item.text }}</view>
					<view class="span">{{ item.date }}</view>
				</view>
			</view>
		</view>
		
		<view  class="my-service-title" @click="handleNavBarBack">
			<uv-icon name="arrow-left" size="30rpx" color="#fff"></uv-icon>
		</view>
	</view>
</template>

<script setup>
	import {onLoad, onShow, onHide } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	
	const banner = ref('https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/WechatIMG299.webp')
	const list = ref([
		{
			'text': '综合治疗分会场-3楼会议室5',
			'url': '/pages/meetingSchedule/comprehensive',
			'img': 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/医疗_听诊.webp',
			'type': 1,
			'date':'2025年6月21'
			
		},{
			'text': '青年论坛分会场-3楼宴会厅B',
			'url': '/pages/meetingSchedule/youth',
			'img': 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/匹配专家.webp',
			'type': 1,
			'date':'2025年6月21'
		},{
			'text': '主会场-3楼宴会厅B',
			'url': '/pages/meetingSchedule/mainVenue',
			'img': 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/会议赞助研讨.png',
			'type': 1,
			'date':'2025年6月22'
		},{
			'text': '护理会场-3楼会议室5',
			'url': '/pages/meetingSchedule/nurse',
			'img': 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/内科护理_1.png',
			'type': 1,
			'date':'2025年6月22'
		}
		
	])

	// 返回
	const handleNavBarBack = () => {
		uni.navigateBack();
	}
	
	const openFun = (item) => {
		if(item.type == 2){
			window.open(item.url)
		}else{
			console.log(item)
			uni.navigateTo({url: item.url})
		}
	}
	
	//分享函数
	const getWin =  async () => { 
		 const currentUrl = 'https://www.yunyakeji.top/';
		
		 // 请求后端获取签名配置
		const res = await vk.callFunction({
			url: 'client/token/pub/index',
			data: { url: currentUrl } // 传递当前URL
		});
		
		const config = res;
		console.log('config',config)
		// 初始化微信SDK
		jWeixin.config({
			debug: false,
			appId: config.appId,
			timestamp: config.timestamp,
			nonceStr: config.noncestr,
			signature: config.signature,
			jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData','onMenuShareAppMessage','onMenuShareTimeline']
		});
		
		jWeixin.ready(() => {
		    // 自定义“分享给朋友”
			 const shareConfig = {
				title: '2025天津市第四届海河肺癌诊疗新进展学术会议',
				desc: '会议日期：6月21日～22日，会议场地：天津梅江中心皇冠假日酒店', // 分享描述
				link: currentUrl, // 使用当前URL
				imgUrl: 'https://mp-9cd2f666-e017-4f0e-a8b2-2c4583bc29c1.cdn.bspapp.com/WechatIMG192.webp', // 分享图标
			};
			
		    jWeixin.updateAppMessageShareData(shareConfig);
		
		    // 自定义“分享到朋友圈”
		    jWeixin.updateTimelineShareData(shareConfig);
			
			// 兼容旧版API
			  jWeixin.onMenuShareAppMessage(shareConfig);
			  
			  jWeixin.onMenuShareTimeline(shareConfig);
		});
		
		jWeixin.error(err => {
			console.error('微信SDK初始化失败', err);
		});
	}
	
	onLoad(() => {
		getWin()
	})
</script>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		max-width: 750px;
		height: 100vh;
		background: no-repeat center bottom;
		background-size: auto 100%;
		box-sizing: border-box;
		position: relative;
		display: block;
		overflow: hidden;
		margin: 0 auto;
		background-color: #f9fafb;

		.banner {
			width: 100%;
			height: auto;
			margin: 0 auto 48rpx;
		}
		
		.my-service-title {
			width: 54rpx;
			height: 54rpx;
			background: rgba(24, 31, 67, 0.8);
			border-radius: 16rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			position: fixed;
			top: 30rpx;
			left: 30rpx;
			z-index: 99;
		}
		
		.title{
			width: 100%;
			height: 56rpx;
			font-family: Roboto, Roboto;
			font-weight: 600;
			font-size: 36rpx;
			color: #1F2937;
			line-height: 56rpx;
			margin-bottom: 34rpx;
			padding: 0 34rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			
			&::before{
				content: '';
				width: 8rpx;
				height: 32rpx;
				background: #0052D9;
				border-radius: 4rpx;
				margin-right: 12rpx;
				display: inline-block;
				vertical-align: middle;
			}
			
		}

		.cardView {
			width: 100%;
			height: auto;
			display: flex;
			flex-direction: column;
			margin: 0 auto;
			align-items: center;
			justify-content: center;
			gap: 32rpx;
			padding: 0 34rpx;
			box-sizing: border-box;
			
			.cardItme {
				width: 100%;
				height: 148rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0,0,0,0.05);
				border-radius: 32rpx ;
				border: 2rpx solid #F3F4F6;
				box-sizing: border-box;
				padding: 34rpx;
				display: flex;
				align-items: center;
				gap: 24rpx;
				
				
				.imgView {
					width: 90rpx;
					height: 90rpx;
					background: rgba(5,66,215,0.1);
					border-radius: 80rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					
					
					.img{
						width: 55%;
					}
				}

				.text {
					font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
					font-weight: 700;
					font-size: 34rpx;
					line-height: 46rpx;
					color: #181F43;
					position: relative;
					top: 6rpx;
					
					.span{
						font-size: 26rpx;
						color: #8F959E;
						font-weight: 500;
					}
				}
			}
		}
	}
</style>